package tests;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import coreSimulation.Baggage;
/**
 * Test the IllegalStateException thrown by the constructor of the Baggage
 * class using different illegal dimensions
 */
public class BaggageTest {

	Baggage b;

	
/**
 * test exception for width too small
 */
	@Test(expected = IllegalStateException.class)
	public void testBaggageInvalidWidth() {
		b = new Baggage(0, 1, 1, 1);

	}

	
	/**
	 * test exception for height too small
	 */
	@Test(expected = IllegalStateException.class)
	public void testBaggageInvalidHeight() {
		b = new Baggage(1, 0, 1, 1); 

	}

	
	/**
	 * test exception for height too small
	 */
	@Test(expected = IllegalStateException.class)
	public void testBaggageInvalidDepth() {
		b = new Baggage(1, 1, 0, 1); // width too small

	}
	/**
	 * test exception for height too small
	 */
	@Test(expected = IllegalStateException.class)
	public void testBaggageWeightTooSmall() {
		b = new Baggage(1, 1, 1, 0); // weight too small

	}

	@Test
	public void testBaggageWeightLimit() {
		b = new Baggage(1, 1, 1, 50); // weight at the maximum limit
		assertEquals(b.getWeight(), 50, 0);

	}

	@Test(expected = IllegalStateException.class)
	public void testBaggageWeightTooLarge() {
		b = new Baggage(1, 1, 1, 50.1); // weight too large

	}

	@Test
	public void testGetWidth() {
		b = new Baggage(10, 15, 20, 25.1);
		assertEquals("The getWidth method failed.", 10, b.getWidth());
	}

	@Test
	public void testGetHeight() {
		b = new Baggage(10, 15, 20, 25.1);
		assertEquals("The getWidth method failed.", 15, b.getHeight());
	}

	@Test
	public void testGetDepth() {
		b = new Baggage(10, 15, 20, 25.1);
		assertEquals("The getWidth method failed.", 20, b.getDepth());
	}

	@Test
	public void testGetWeight() {
		b = new Baggage(10, 15, 20, 25.1);
		assertEquals("The getWidth method failed.", 25.1, b.getWeight(), 0);
	}

}
